[NNAPI EP] Add EP option to disable CPU#6593
Merged
guoyu-wang merged 6 commits intomasterfrom Feb 11, 2021
Merged
Conversation
edgchen1
reviewed
Feb 8, 2021
| // using the list of target devices | ||
| bool use_create_for_devices = false; | ||
| if (!nnapi_target_devices_.empty()) { | ||
| bool supported_ops[num_nnapi_ops_]; |
Contributor
There was a problem hiding this comment.
i think that the array needs to have a constant value as the dimension. interestingly, it seems only MSVC fails to compile something like this. https://godbolt.org/z/G96c3Y
maybe use std::unique_ptr<bool[]> instead?
Contributor
Author
There was a problem hiding this comment.
I didn't know that, changed to use std::unique_ptr<bool[]>
Contributor
There was a problem hiding this comment.
cool, would also suggest using onnxruntime::make_unique<bool[]>(num_nnapi_ops_)
skottmckay
reviewed
Feb 10, 2021
include/onnxruntime/core/providers/nnapi/nnapi_provider_factory.h
Outdated
Show resolved
Hide resolved
skottmckay
reviewed
Feb 10, 2021
|
|
||
| auto* it = std::find(supported_ops, supported_ops + num_nnapi_ops_, false); | ||
| if (it != supported_ops + num_nnapi_ops_) { | ||
| // There are some ops not supported by the list of the target devices |
Contributor
There was a problem hiding this comment.
nit: std::any_of may be slightly clearer
Contributor
Author
There was a problem hiding this comment.
Change to std::all_of
skottmckay
approved these changes
Feb 11, 2021
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Description: [NNAPI EP] Add EP option to disable CPU
Motivation and Context